<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="TLoginSession" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="TLoginSession" type="EIA.Basic.Model.TLoginSession, EIA.Basic.Model" />
</alias>

<resultMaps>
<resultMap id="select-tloginsession-result" class="TLoginSession">
<constructor>
    <argument argumentName="ses_id" column="ses_id"/>
    <argument argumentName="ses_token" column="ses_token"/>
    <argument argumentName="stf_id" column="stf_id"/>
    <argument argumentName="login_id" column="login_id"/>
    <argument argumentName="login_time" column="login_time"/>
    <argument argumentName="last_vist_time" column="last_vist_time"/>
    <argument argumentName="is_active" column="is_active"/>
</constructor>
<!--
    <result property="SesId" column="ses_id"/>
    <result property="SesToken" column="ses_token"/>
    <result property="StfId" column="stf_id"/>
    <result property="LoginId" column="login_id"/>
    <result property="LoginTime" column="login_time"/>
    <result property="LastVistTime" column="last_vist_time"/>
    <result property="IsActive" column="is_active"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_TLoginSession_where_pk">
WHERE ses_id=#SesId#
</sql>

<sql id="sql_TLoginSession_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="SesId" prepend="AND">ses_id=#SesId#</isPropertyAvailable>
    <isPropertyAvailable property="SesToken" prepend="AND">ses_token LIKE concat('%', #SesToken#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend="AND">stf_id LIKE concat('%', #StfId#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="LoginId" prepend="AND">login_id LIKE concat('%', #LoginId#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="LoginTime" prepend="AND">login_time=#LoginTime#</isPropertyAvailable>
    <isPropertyAvailable property="LastVistTime" prepend="AND">last_vist_time=#LastVistTime#</isPropertyAvailable>
    <isPropertyAvailable property="IsActive" prepend="AND">is_active=#IsActive#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_TLoginSession_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="SesToken" prepend=",">ses_token=#SesToken#</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">stf_id=#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="LoginId" prepend=",">login_id=#LoginId#</isPropertyAvailable>
    <isPropertyAvailable property="LoginTime" prepend=",">login_time=#LoginTime#</isPropertyAvailable>
    <isPropertyAvailable property="LastVistTime" prepend=",">last_vist_time=#LastVistTime#</isPropertyAvailable>
    <isPropertyAvailable property="IsActive" prepend=",">is_active=#IsActive#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectTLoginSession" parameterClass="" resultMap="TLoginSession.select-tloginsession-result">
SELECT *
FROM t_login_session
<include refid="sql_TLoginSession_where_pk"/><!--where-->
</select>

<select id="SelectTLoginSession_CV" parameterClass="System.Collections.IDictionary" resultMap="TLoginSession.select-tloginsession-result">
SELECT *
FROM t_login_session
<include refid="sql_TLoginSession_where_cv"/><!--where-->
</select>

<insert id="InsertTLoginSession" parameterClass="TLoginSession">
<!--pre selectKey place-->
INSERT INTO t_login_session(
<dynamic prepend=" ">
    <isPropertyAvailable property="SesToken" prepend=",">ses_token</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">stf_id</isPropertyAvailable>
    <isPropertyAvailable property="LoginId" prepend=",">login_id</isPropertyAvailable>
    <isPropertyAvailable property="LoginTime" prepend=",">login_time</isPropertyAvailable>
    <isPropertyAvailable property="LastVistTime" prepend=",">last_vist_time</isPropertyAvailable>
    <isPropertyAvailable property="IsActive" prepend=",">is_active</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="SesToken" prepend=",">#SesToken#</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="LoginId" prepend=",">#LoginId#</isPropertyAvailable>
    <isPropertyAvailable property="LoginTime" prepend=",">#LoginTime#</isPropertyAvailable>
    <isPropertyAvailable property="LastVistTime" prepend=",">#LastVistTime#</isPropertyAvailable>
    <isPropertyAvailable property="IsActive" prepend=",">#IsActive#</isPropertyAvailable>
</dynamic>
)
<selectKey resultClass="int" type="post" property="SesId" >
SELECT LAST_INSERT_ID()
</selectKey>
</insert>

<update id="UpdateTLoginSession" parameterClass="System.Collections.IDictionary">
UPDATE t_login_session
<include refid="sql_TLoginSession_set_cols"/><!--set-->
<include refid="sql_TLoginSession_where_pk"/><!--where-->
</update>

<delete id="DeleteTLoginSession" parameterClass="">
DELETE FROM t_login_session
<include refid="sql_TLoginSession_where_pk"/><!--where-->
</delete>

<statement id="DeleteTLoginSession_CV" parameterClass="TLoginSession">
DELETE FROM t_login_session
<include refid="sql_TLoginSession_where_cv"/><!--where-->
</statement>

<delete id="ClearTLoginSession">
DELETE FROM t_login_session
</delete>
</statements>
</sqlMap>